home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / text / manipulation / cv.lha / cv / cvt / args.c next >
Encoding:
C/C++ Source or Header  |  1993-12-31  |  1.4 KB  |  56 lines

  1. /*
  2.  *  ARGS.C
  3.  */
  4.  
  5. #include <string.h>
  6. #include <stdio.h>
  7.  
  8. static char *howtouse[]= {
  9.   "-c", "--charset-size",    "set local charset size (default is -c256)",
  10. #ifdef DEBUG
  11.   "-d", "--debug",           "set debug level (0..4)",
  12. #endif
  13.   "-E", "--stderr",          "redirect error messages",
  14.   "-e", "--max-errors",      "set maximum #of errors until scanner aborts",
  15.   "-f", "--file",            "set conversion scriptfile name",
  16.   "-h", "--help",            "display this short usage information and exit",
  17.   "-l", "--from",            "take input filenames from a file",
  18.   "-n", "--dry-run",         "only check the scriptfile(s) -- don't convert",
  19.   "-n", "--dryrun",          "",
  20.   "-o", "--output",          "set output filename (%s for the input filename)",
  21.   "-s", "--silent",          "don't print output filenames when converting",
  22.   "-s", "--quiet",           "",
  23.   "-t", "--temp",            "set filename for temporary data",
  24.   "-v", "--version",         "display author version information",
  25.   "-x", "--check-exists",    "check input file existance before converting",
  26.   "-x", "--check-existence", "",
  27.   (char *)0L, (char *)0L, (char *)0L
  28. };
  29.  
  30. char *
  31. convert_args(s)
  32. char *s;
  33. {
  34.   char **t= howtouse;
  35.  
  36.   while(*t)
  37.   { if(!strcmp(s,t[1]))
  38.       break;
  39.     t= &t[3];
  40.   }
  41.  
  42.   return (*t) ? *t : s;
  43. }
  44.  
  45. void
  46. display_args(void)
  47. {
  48.   char **t= howtouse;
  49.  
  50.   while(*t)
  51.   { if(t[2] && *t[2])
  52.       printf("%2s or %-16s %s\n",t[0],t[1],t[2]);
  53.     t= &t[3];
  54.   }
  55. }
  56.